﻿cmake_minimum_required(VERSION 3.20)

project(UnifiedServiceKits LANGUAGES CXX)

cmake_policy(SET CMP0071 NEW)

set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 17)


list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")


set(USK_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR})
set(USK_DEPS_DIR "${USK_ROOT_DIR}/deps")
set(CPM_SOURCE_CACHE "${USK_DEPS_DIR}")
set(USK_SOURCE_DIR ${USK_ROOT_DIR})
set(USK_CMAKE_DIR "${CMAKE_CURRENT_LIST_DIR}/cmake")

# 服务的头文件路径
set(USK_SERVICES_INCLUDE_DIR ${USK_ROOT_DIR}/include)


# 生成器表达式，根据实际构建类型生成对应的值
set(CONFIG_TYPE $<IF:$<CONFIG:Debug>,Debug,Release>)
# 设置输出目录
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib/${CONFIG_TYPE})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/${CONFIG_TYPE})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/${CONFIG_TYPE})
set(CMAKE_PDB_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/pdb/${CONFIG_TYPE})

include(CMakeParseArguments)
include(CMakePackageConfigHelpers)
include(CheckCXXSourceCompiles)
include(utilities)
include(CPM/CPM)
include(deps/poco)
include(deps/fmt)
include(deps/cppmicroservices)

usFunctionCheckResourceLinking()

message(STATUS "CppMicroServices_LIBRARIES=${CppMicroServices_LIBRARIES}")

add_subdirectory(src)

add_subdirectory(apps)




# Qt版本
# set(USE_QT_VERSION "5" CACHE STRING "Expected Qt version")
# mark_as_advanced(USE_QT_VERSION)
# set_property(CACHE USE_QT_VERSION PROPERTY STRINGS 5)

# # 查找Qt库
# set(QT_COMPONENTS Core Gui Widgets Sql Concurrent)
# find_package(Qt${USE_QT_VERSION} COMPONENTS ${QT_COMPONENTS} REQUIRED)

# if(NOT Qt5_FOUND)
#     message(FATAL_ERROR "Qt5 not found")
# endif()

# set(QtPrefix Qt${USE_QT_VERSION})

# set(CMAKE_AUTOMOC ON)
# set(CMAKE_AUTOUIC ON)
# set(CMAKE_AUTORCC ON)



# add_subdirectory(src/plugin_framework)
# add_subdirectory(src/osgi_system)

# include_directories(${USK_SERVICES_INCLUDE_DIR})

# add_subdirectory(src/plugins)



# add_subdirectory(src/test/test_framework)